using System;
using System.Collections;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;

namespace Tool.BaseClass
{
	public class GClass42
	{
		public static void smethod_0(string string_0)
		{
			if (!Directory.Exists(string_0))
			{
				Directory.CreateDirectory(string_0);
			}
		}

		public static bool smethod_1(string string_0, string string_1, Encoding encoding_0, bool bool_0)
		{
			if (File.Exists(string_0))
			{
				File.Delete(string_0);
			}
			if (bool_0)
			{
				string_1 = string_1.Replace("\r\n", "\r\n");
			}
			StreamWriter streamWriter = new StreamWriter(string_0, false, encoding_0);
			streamWriter.Write(string_1);
			streamWriter.Flush();
			streamWriter.Close();
			return File.Exists(string_0);
		}

		public static byte[] smethod_2(string string_0)
		{
			FileStream fileStream = null;
			byte[] array = new byte[0];
			byte[] result;
			try
			{
				fileStream = new FileStream(string_0, FileMode.Open, FileAccess.Read);
				BinaryReader binaryReader = new BinaryReader(fileStream);
				binaryReader.BaseStream.Seek(0L, SeekOrigin.Begin);
				array = binaryReader.ReadBytes((int)binaryReader.BaseStream.Length);
				result = array;
			}
			catch
			{
				result = array;
			}
			finally
			{
				if (fileStream != null)
				{
					fileStream.Close();
				}
			}
			return result;
		}

		public static void smethod_3(string string_0, Hashtable hashtable_0)
		{
			Hashtable hashtable = new Hashtable();
			foreach (DictionaryEntry dictionaryEntry in hashtable_0)
			{
				if (File.Exists(dictionaryEntry.Value.ToString().Trim()))
				{
					hashtable.Add(dictionaryEntry.Key, dictionaryEntry.Value);
				}
			}
			FileStream fileStream = new FileStream(string_0, FileMode.Create);
			BinaryFormatter binaryFormatter = new BinaryFormatter();
			binaryFormatter.Serialize(fileStream, hashtable);
			fileStream.Close();
		}

		public static Hashtable smethod_4(string string_0)
		{
			Hashtable result = new Hashtable();
			if (File.Exists(string_0))
			{
				FileStream fileStream = new FileStream(string_0, FileMode.OpenOrCreate);
				BinaryFormatter binaryFormatter = new BinaryFormatter();
				result = (Hashtable)binaryFormatter.Deserialize(fileStream);
				fileStream.Close();
			}
			return result;
		}
	}
}
